<style>
.require{
	font-weight:bold;
	color:#f00;
}
</style>
<div class="content">
	<div class="content_i">
		<?php
            if ($error == 1) 
            {
                echo "<div style='line-height:1.4em; width:50%; padding:5px; 
					min-height:20px; background-color:#fedfe3; border-top: 1px solid #fa6378; 
						border-bottom: 1px solid #fa6378; font-size:12px'>";
                	echo $message ;
                echo "</div>";
            }
			
            echo CHtml::beginForm(
				array($this->controller_id."/save", 
					"user_id"=>$user->id, 
					"page" => $page
				),
				"post",
				array("id"=>"form_edit")
			);
            
            // Thong tin dang nhap
            echo "<h2>";
				echo CHtml::image(Yii::app()->baseUrl."/assets/icon/icon-16-key.png");
				echo " Thông tin đăng nhập";
			echo "</h2>";
			
            echo "<table cellpadding='3' cellspacing='0 border='0' width='50%'>";
                echo "<tr>";
                    echo "<td class='label' width='120'>";
						echo "Username <span class='require'>*</span>";
					echo "</td>";
                    echo "<td>";
                    echo CHtml::textField(
						"username", 
						$user["username"], array('style'=>'width:400px')
					);
                    echo "</td>";
                echo "</tr>";
                
				if ($user["id"] == 0)
				{
					echo "<tr>";
						echo "<td class='label' width='120'>".
							"Password <span class='require'>*</span>";
						echo "</td>";
						echo "<td>";
						echo CHtml::passwordField(
							"password", $user["password"], array('style'=>'width:400px'));
						echo "</td>";
					echo "</tr>";
					
					echo "<tr>";
						echo "<td class='label' width='100'>";
							echo "Gõ lại Password <span class='require'>*</span>";
						echo "</td>";
						echo "<td>";
						echo CHtml::passwordField(
							"repassword", 
							"", 
							array('style'=>'width:400px')
						);
						echo "</td>";
					echo "</tr>";
				}
			
            echo "</table>";
            
            // Thong tin ca nhan
            echo "<h2>";
				echo CHtml::image(Yii::app()->baseUrl."/assets/icon/icon-16-info.png");
				echo " Thông tin cá nhân";
			echo "</h2>";
            echo "<table cellpadding='3' cellspacing='0 border='0' width='50%'>";
                echo "<tr>";
                    echo "<td class='label' width='100'>"."Họ và tên "."</td>";
                    echo "<td>";
                        echo CHtml::textField(
							"full_name", 
							$user["full_name"], 
							array('style'=>'width:400px')
						);
                    echo "</td>";
                echo "</tr>";
                
				echo "<tr>";
                    echo "<td class='label' width='100'>"."Tên thường gọi "."</td>";
                    echo "<td>";
                        echo CHtml::textField(
							"alias", 
							$user["alias"], 
							array('style'=>'width:400px')
						);
                    echo "</td>";
                echo "</tr>";
				
                echo "<tr>";
                    echo "<td class='label' width='100'>"."Địa chỉ"."</td>";
                    echo "<td>";
                    echo CHtml::textField("address", $user["address"], array('style'=>'width:400px'));
                    echo "</td>";
                echo "</tr>";
                
                echo "<tr>";
                    echo "<td class='label' width='120'>"."Điện thoại"."</td>";
                    echo "<td>";
                    echo CHtml::textField(
						"phone", 
						$user["phone"], 
						array('style'=>'width:400px')
					);
                    echo "</td>";
                echo "</tr>";
                
                echo "<tr>";
                    echo "<td class='label' width='100'>"."Email "."</td>";
                    echo "<td>";
                    echo CHtml::textField(
						"email", 
						$user["email"], 
						array('style'=>'width:400px')
					);
                    echo "</td>";
                echo "</tr>";
                
                echo "<tr>";
                    echo "<td class='label'>"."Ngày sinh"."</td>";
                    echo "<td>";
                    echo CHtml::textField("ngay", $ngay , array('size'=>'5'));
                    echo " &nbsp;Tháng ";
					echo CHtml::textField("thang", $thang , array('size'=>'5'));
                    echo " &nbsp;Năm ";
					echo CHtml::textField("nam", $nam , array('size'=>'10'));
                    echo "</td>";
                echo "</tr>";
                
                echo "<tr>";
                    echo "<td class='label'>"."Giới tính"."</td>";
                    echo "<td>";
                    $list_gender = array(-1=>"Giới tính", 0=>"Nữ", 1=>"Nam");
                    echo CHtml::dropDownList("gender", $user["gender"] , $list_gender);
                    echo "</td>";
                echo "</tr>";
                
                echo "<tr>";
                    echo "<td >"."</td>";
                    echo "<td>";
                        // Submit Button
						echo "<div class='space_5'></div>";
	
						echo 
							"<div class='button' id='button_submit'>" .
								"<div style='float:left; width:20px;'>" .
									CHtml::image(Yii::app()->baseUrl."/assets/icon/icon-16-save.png") .
								"</div>" .
								"<div style='float:left; min-width:40px;font-weight:bold'>".
									"Save" .
								"</div>" .
							"</div>";
						
						echo 
							"<div class='button' id='button_cancel'>" .
								"<div style='float:left; width:20px;'>" .
									CHtml::image(Yii::app()->baseUrl."/assets/icon/icon-16-check.png") .
								"</div>" .
								"<div style='float:left; min-width:50px;font-weight:bold'>".
									"Cancel" .
								"</div>" .
							"</div>";
						
                    echo "</td>";
                echo "</tr>";
            echo "</table>";
            echo CHtml::endForm();
        ?>
	</div><!-- end div content_i -->
</div><!-- end div content -->

<script language="javascript">
$(document).ready(function(){

	$('#button_submit').click(function(){
		$('#form_edit').submit();
	});
	
	
	
	$('#button_cancel').click(function(){
		window.location = '<?php
			$url = Yii::app()->createUrl(
				$this->route . "/view",
				array("page" =>$page)
			);
			echo $url;
		?>';
	});
});
</script>
